
module.exports = {
  login: function(account,password,suc=()=>{},fail=()=>{}){
    // fancy code that sends an email
    //console.log(People.findOne);
    Account.findOne({account,password},(err,target)=>{
        if(target){
            People.findOneById(target.targetId,(err,targetPeople)=>{
                if(err || !targetPeople){
                    fail();
                }
                suc(targetPeople)
            })
        }else{
            fail();
        }
    })
  }
}
